package com.hh.common.request.integral;

import com.hh.common.request.StoreProductAttrAddRequest;
import com.hh.common.request.StoreProductAttrValueAddRequest;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List;

@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class StoreIntegralAddRequest {

    @ApiModelProperty(value = "商品积分产品表id|新增时不填，修改时必填")
    private Integer id;

    @ApiModelProperty(value = "主商品id", required = true)
    @NotNull(message = "主商品id不能为空")
    private Integer productId;

    @NotNull(message = "分类id不能为空")
    private Integer categoryId;

    @ApiModelProperty(value = "推荐图", required = true)
    @NotBlank(message = "推荐图不能为空")
    @Length(max = 255, message = "推荐图名称长度不能超过255个字符")
    private String image;

    @NotEmpty(message = "轮播图不能为空")
    @Size(min = 1, max = 3, message = "最多上传三张轮播图")
    private List<String> sliderImages;

    @ApiModelProperty(value = "活动标题", required = true)
    @NotBlank(message = "活动标题不能为空")
    @Length(max = 255, message = "活动标题长度不能超过255个字符")
    private String title;

    @ApiModelProperty(value = "简介", required = true)
    @NotBlank(message = "简介不能为空")
    @Length(max = 255, message = "简介长度不能超过255个字符")
    private String info;

    @ApiModelProperty(value = "单位名", required = true)
    @NotBlank(message = "单位名不能为空")
    @Length(max = 16, message = "单位名长度不能超过16个字符")
    private String unitName;

    @ApiModelProperty(value = "积分商品状态 0=关闭 1=开启", required = true)
    @NotNull(message = "积分商品状态不能为空")
    @Range(min = 0, max = 1, message = "未知的积分商品状态")
    private Integer status;

    @ApiModelProperty(value = "用户兑换的次数", required = true)
    @NotNull(message = "用户兑换的次数")
    private Integer num;

    @ApiModelProperty(value = "运费模板ID", required = true)
    @NotNull(message = "运费模板不能为空")
    private Integer tempId;

    @ApiModelProperty(value = "商品属性", required = true)
    @NotEmpty(message = "商品属性不能为空")
    private List<StoreProductAttrAddRequest> attr;

    @ApiModelProperty(value = "商品属性详情|只传选中项", required = true)
    @NotEmpty(message = "商品属性详情不能为空")
    private List<StoreProductAttrValueAddRequest> attrValue;

    @ApiModelProperty(value = "商品描述")
    private String content;

    @ApiModelProperty(value = "排序")
    private Integer sort;
}
